<template>
	<view class="parent-view">
		<view class="address-view" @click="goAddressList">
			<view class="address-txt-view">
				<text class="address-txt">收货地址</text>
			</view>
			<view class="name-view">
				<text class="address-name">{{orderData.confirm_name}}</text>
				<text class="address-phone">{{orderData.confirm_phone}}</text>
			</view>
			<view class="address-area" v-if="orderData.address">
				<image class="address-icon" src="../../static/address-icon.png"></image>{{orderData.address}}
			</view>
		</view>
		
		<view class="goods-view">
			<text class="goods-txt">商品信息</text>
			<view class="goods-info-view">
				<image class="goods-image" :src="orderData.goods[0].goods_sku_img"></image>
				<view class="goods-info-txt-view">
					<text class="goods-title">{{orderData.goods[0].goods_name}}</text>
					<text class="goods-desc">{{orderData.goods[0].goods_sku_info}}</text>
					<text class="goods-price">¥{{orderData.goods[0].goods_page_price}}</text>
				</view>
			</view>
			<view class="goods-price-view">
				<text class="dingdan-txt">订单金额：</text>
				<text class="dingdan-price">{{orderData.order_price}}元</text>
				<text class="goods-count-txt">数量：{{orderData.goods[0].goods_num}}</text>
			</view>
			<view class="order-txt" style="margin-top: 22px;" v-if="orderData.order_status==0">订单状态：待付款</view>
			<view class="order-txt" style="margin-top: 22px;" v-if="orderData.order_status==1">订单状态：待发货</view>
			<view class="order-txt" style="margin-top: 22px;" v-if="orderData.order_status==2">订单状态：待确认</view>
			<view class="order-txt" style="margin-top: 22px;" v-if="orderData.order_status==3">订单状态：已完成</view>
			<view class="order-txt">支付方式：{{orderData.pay_type}}</view>
			<view class="order-txt">支付时间：{{orderData.pay_time}}</view>
			<view class="order-txt">订单编号：{{orderData.ordersn}}</view>
			<view class="order-view" @click="copyDanhao" v-if="orderData.delivery_num">
				<view class="order-txt">物流单号：{{orderData.delivery_num}}</view>
				<text class="copy-btn">复制</text>
			</view>
			<view class="order-txt" v-if="orderData.delivery_company">物流公司：{{orderData.delivery_company}}</view>
			<view class="order-txt" style="margin-bottom: 12.5px;">订单备注：{{orderData.remark?orderData.remark:"暂无"}}</view>
		</view>
		
	</view>
</template>

<script>
	import request from '../index/request.js';
	export default {
		data() {
			return {
				ordersn:"SH202111041112428805",
				orderData:{}
			}
		},
		methods: {
			onLoad: function(options) {
				this.appUtil.saveAppInviteId(options)
				if(options.ordersn){
					this.ordersn=options.ordersn
				}
				this.getOrderInfo()
			},
			onShow:function(){
				this.share.url='/pages/tabBar/home/index?appInviteId='+this.appUtil.getAppInviteId()
				this.share.shareType=1
			},
			getOrderInfo:function(){
				var that=this
				request.post("api/mall/GetOrderInfo", {
					ordersn:this.ordersn
				}).then(data => {
					that.orderData=data
				})
			},
			copyDanhao:function(){
				uni.setClipboardData({
				    data: this.orderData.delivery_num,
				    success: function () {
				    }
				});
			}
		}
	}
</script>

<style>
	@import "index.css";
</style>
